#ifndef ELRESULT_H
#define ELRESULT_H

#include "../basic/elcomponent.h"

class ElIcon;

class ElResult : public ElComponent
{
    Q_OBJECT
public:
    enum IconType { Success, Warning, Info, Error };

    ElResult(QWidget *parent = nullptr);
    ElResult(const QString &title, const QString &subTitle, QWidget *parent = nullptr);

    QString title() const;
    void setTitle(const QString &title);

    QString subTitle() const;
    void setSubTitle(const QString &subTitle);

    ElIcon *icon() const;
    void setIcon(IconType type);
    void setIcon(const QString &fileName);
    void setIcon(ElIcon *icon);

    QWidget *extraFooter() const;
    void setExtraFooter(QWidget *footer);

protected:
    void paintEvent(QPaintEvent *e) override;
    void initPalette() override;

private:
    Q_PROPERTY(QString title READ title WRITE setTitle)
    Q_PROPERTY(QString subTitle READ subTitle WRITE setSubTitle)

    static const int Icon_Size;
    static const int Icon_Text_Spacing;
    static const int Title_Sub_Spacing;
    static const int Text_Footer_Spacing;

    QString _title;
    QString _sub_title;
    ElIcon *_icon = nullptr;
    QWidget *_extra_footer = nullptr;
};

#endif // ELRESULT_H
